#include "modifycheckindialog.h"
#include "ui_modifycheckindialog.h"

ModifyCheckinDialog::ModifyCheckinDialog(QWidget *parent,
                                         const QString &studentName,
                                         const QString &studentId,
                                         const QString &checkinDate,
                                         const QString &checkinTime,
                                         const QString &status,
                                         const QString &remarks)
    : QDialog(parent)
    , ui(new Ui::ModifyCheckinDialog)
{
    ui->setupUi(this);

    ui->lineEditStudentName->setText(studentName);
    ui->lineEditStudentId->setText(studentId);
    QDate::fromString(checkinDate);
    ui->dateEditCheckinDate->setDate(QDate::currentDate());
    ui->timeEditCheckinTime->setTime(QTime::fromString(checkinTime));
    ui->lineEditStatus->setText(status);
    ui->lineEditRemarks->setText(remarks);
}

ModifyCheckinDialog::~ModifyCheckinDialog()
{
    delete ui;
}


QString ModifyCheckinDialog::getStudentName() const
{
   return ui->lineEditStudentName->text();
}
QString ModifyCheckinDialog::getStudentId() const
{
    return ui->lineEditStudentId->text();
}
QString ModifyCheckinDialog::getCheckinDate() const
{
    return ui->dateEditCheckinDate->date().toString("yyyy-MM-dd");
}
QString ModifyCheckinDialog::getCheckinTime() const
{
    return ui->timeEditCheckinTime->time().toString("HH:mm:ss");
}
QString ModifyCheckinDialog::getStatus() const
{
    return ui->lineEditStatus->text();
}
QString ModifyCheckinDialog::getRemarks() const
{
    return ui->lineEditRemarks->text();
}

void ModifyCheckinDialog::on_pushButtonExit_clicked()
{
    close();
}

void ModifyCheckinDialog::on_pushButtonConfirm_clicked()
{
    accept();
}
